{include file="header.html"}

<div id="rightTop">
    <p>提现管理</p>
    <ul class="subnav">
        <li><span>{$lang.manage}</span></li>
    </ul>
</div>
<div class="mrightTop" style="height: 80px;">
    <div class="fontl">
        <form method="get">
                <input type="hidden" name="app" value="withdraw" />
                <input type="hidden" name="act" value="index" />
                <select class="querySelect" name="status">
                    <option value="">状态</option>
                    {html_options options=$withdraw_status_list selected=$query.status}
                </select>
                申请时间:<input style="width: 160px;" class="queryInput" type="text" value="{$add_time_from}" id="add_time_from" name="add_time_from"  />
                至:<input class="queryInput" style="width: 160px;" type="text" value="{$add_time_to}" id="add_time_to" name="add_time_to"  />
                申请人手机号：
                <input class="queryInput" type="text" name="phone_mob" value="{$phone_mob}"/>
                <input type="submit" class="formbtn" value="{$lang.query}" onclick="$('[name=act]').val('index');"/>
                <input type="submit" class="btn1" value="导出" onclick="$('[name=act]').val('excel');"/>
                <!--{if $filtered}-->
                <a class="formbtn1" href="index.php?app=withdraw">{$lang.cancel_query}</a>
                <!--{/if}-->
        </form>
    </div>
    <div class="fontr">
        {if $res}{include file=page.top.html}{/if}
    </div>
</div>
<div class="tdare">
    <table width="100%" cellspacing="0" class="dataTable">
        <!--{if $res}-->
        <tr class="tatr1">
            <td class="firstCell"><span fieldname="seller_id">ID</span></td>
            <td><span fieldname="phone_mob">提现订单号</span></td>
            <td><span fieldname="phone_mob">申请人手机号</span></td>
            <td><span fieldname="money">提现金额</span></td>
            <td><span fieldname="type">提现方式</span></td>
            <td><span fieldname="number">提现账户</span></td>
            <td><span fieldname="number">账户姓名</span></td>
            <td><span fieldname="create_time">申请时间</span></td>
            <!--<td><span fieldname="finish_time">完成时间</span></td>-->
            <td><span fieldname="status">状态</span></td>
            <td width="25%">{$lang.handler}</td>
        </tr>
        <!--{/if}-->
        <!--{foreach from=$res item=v}-->
        <tr class="tatr2">
            <td class="firstCell">{$v.id|escape}</td>
            <td>{$v.sn}</td>
            <td>{$v.phone_mob}</td>
            <td>{$v.money|price}</td>
            <td>{$v.type_value}</td>
            <td>{$v.number}</td>
            <td>{$v.user_name}</td>
            <td>{$v.create_time|date:complete}</td>
            <!--<td>{$v.finish_time|date:Y-m-d H:i:s}</td>-->
            <td>{$v.status_value}</td>
            <td>
                <!-- {if $v.status eq 1}-->
                    <a  href="javascript:;" class="agree" data-id="{$v.id}">通过</a>  |
                    <a  href="javascript:;" class="refuse" data-id="{$v.id}">拒绝</a>
                <!-- {elseif $v.status eq 2}-->
                    <a href="javascript:;" class="make_money" data-id="{$v.id}">打款</a>
                <!-- {elseif $v.status eq 3}-->
                    <a href="javascript:;" class="reason" data-id="{$v.id}">查看拒绝原因</a>
                <!-- {elseif $v.status eq 5} -->
                    <a href="javascript:;" data-id="{$v.id}" class="reason">查看失败原因</a>
                <!-- {else}-->
                    <a href="javascript:;">无</a>
                <!--{/if}-->
            </td>
        </tr>
        <!--{foreachelse}-->
        <tr class="no_data">
            <td colspan="7">{$lang.no_data}</td>
        </tr>
        <!--{/foreach}-->
    </table>
    <div id="dataFuncs">
        <div class="pageLinks">
            {if $res}{include file=page.bottom.html}{/if}
        </div>
    </div>
    <div class="clear"></div>
</div>
{include file="footer.html"}
<script src="//cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script src="//cdn.bootcss.com/layer/2.3/layer.js"></script>
<script src="templates/js/laydate/laydate.js"></script>
<script type="text/javascript">
    //时间选择器
    laydate.render({
        elem: '#add_time_from'
        ,type: 'datetime'
    });

    //时间选择器
    laydate.render({
        elem: '#add_time_to'
        ,type: 'datetime'
    });
</script>
<script>
    //ajax请求地址  操作是否同意申请接口
    var url = "index.php?app=withdraw&act=operation";
    //同意申请
    $(".agree").click(function(){
        var id = $(this).attr('data-id');
        layer.confirm('确认审核通过这个申请么？', {
            btn: ['是','否'] //按钮
        }, function(){
            $.post(url,{
                id:id,
                status:2
            },function(data){
                var res = JSON.parse(data);
                layer.msg(res.msg,function(){
                    window.location.reload();
                });
            })
        })
    })
    //拒绝操作
    $(".refuse").click(function(){
        var id = $(this).attr('data-id');
        layer.prompt({title: '请输入拒绝的原因！', formType: 2}, function(text, index){
            layer.close(index);
            $.post(url,{
                id:id,
                status:3,
                return_msg:text
            },function(data){
                var res = JSON.parse(data);
                layer.msg(res.msg,function(){
                    window.location.reload();
                });
            })
        });
    })
    //打款
    $(".make_money").click(function(){
        var id = $(this).attr('data-id');
        var url = "index.php?app=withdraw&act=makeMoney";
        layer.confirm('确认要打款么？', {
            btn: ['是','否'] //按钮
        }, function(){
            $.post(url,{
                id:id,
                status:4
            },function(data){
                var res = JSON.parse(data);
                layer.msg(res.msg,function(){
                    window.location.reload();
                });
            })
        })
    })
    //查看失败的原因
    $(".reason").click(function(){
        var url = "index.php?app=withdraw&act=reason";
        var id = $(this).attr('data-id');
        $.post(url,{
            id:id
        },function(data){
            var res = JSON.parse(data);
            if(res.code == 1){
                layer.open({
                    type: 1,
                    skin: 'layui-layer-rim', //加上边框
                    area: ['420px', '240px'], //宽高
                    content: res.return_msg
                });
            }else{
                layer.msg(res.msg);
            }
        })
    })
</script>


